package com.probiz.estore.common.model.system.base;

import java.io.Serializable;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import com.probiz.estore.common.model.system.PaymentMethod;

/**
 * PaymentMethod Base Java Bean, base class for the model, mapped directly to database table
 * 
 * Avoid changing this file if not necessary, will be overwritten. 
 *
 */
public class PaymentMethodTbl extends com.probiz.estore.core.model.BaseObject implements Serializable {

    protected Integer paymentMethodId;
	protected String paymentMethodName;
	protected String paymentMethodDetail;
	protected Short paymentMethodType;
	protected String protocol;
	protected String helpLink;
	protected Integer sortOrder;
	protected Short status;
	protected Integer version;
	protected Short iscod;
	protected com.probiz.estore.common.model.system.PaymentGateway paymentGateway;

	protected java.util.Set orderPayments = new java.util.HashSet();

	/**
	 * Default Empty Constructor for class PaymentMethod
	 */
	public PaymentMethodTbl () {
		super();
	}
	
	/**
	 * Default Key Fields Constructor for class PaymentMethod
	 */
	public PaymentMethodTbl (
		 Integer in_paymentMethodId
        ) {
		this.setPaymentMethodId(in_paymentMethodId);
    }

	
	public com.probiz.estore.common.model.system.PaymentGateway getPaymentGateway () {
		return paymentGateway;
	}	
	
	public void setPaymentGateway (com.probiz.estore.common.model.system.PaymentGateway in_paymentGateway) {
		this.paymentGateway = in_paymentGateway;
	}

	public java.util.Set getOrderPayments () {
		return orderPayments;
	}	
	
	public void setOrderPayments (java.util.Set in_orderPayments) {
		this.orderPayments = in_orderPayments;
	}
    

	/**
	 * @return Integer
     * @hibernate.id column="paymentMethodId" type="java.lang.Integer" generator-class="native"
	 */
	public Integer getPaymentMethodId() {
		return this.paymentMethodId;
	}
	
	/**
	 * Set the paymentMethodId
	 */	
	public void setPaymentMethodId(Integer aValue) {
		this.paymentMethodId = aValue;
	}	

	/**
	 * @return Integer
	 */
	public Integer getPaymentGatewayId() {
		return this.getPaymentGateway()==null?null:this.getPaymentGateway().getPaymentGatewayId();
	}
	
	/**
	 * Set the paymentGatewayId
	 */	
	public void setPaymentGatewayId(Integer aValue) {
	    if (aValue==null) {
	    	paymentGateway = null;
	    } else if (paymentGateway == null) {
	        paymentGateway = new com.probiz.estore.common.model.system.PaymentGateway(aValue);
	        paymentGateway.setVersion(Integer.valueOf(0));//set a version to cheat hibernate only
	    } else {
			paymentGateway.setPaymentGatewayId(aValue);
	    }
	}	

	/**
	 * @return String
	 * @hibernate.property column="paymentMethodName" type="java.lang.String" length="32" not-null="true" unique="false"
	 */
	public String getPaymentMethodName() {
		return this.paymentMethodName;
	}
	
	/**
	 * Set the paymentMethodName
	 * @spring.validator type="required"
	 */	
	public void setPaymentMethodName(String aValue) {
		this.paymentMethodName = aValue;
	}	

	/**
	 * @return String
	 * @hibernate.property column="paymentMethodDetail" type="java.lang.String" length="32" not-null="false" unique="false"
	 */
	public String getPaymentMethodDetail() {
		return this.paymentMethodDetail;
	}
	
	/**
	 * Set the paymentMethodDetail
	 */	
	public void setPaymentMethodDetail(String aValue) {
		this.paymentMethodDetail = aValue;
	}	

	/**
	 * @return Short
	 * @hibernate.property column="paymentMethodType" type="java.lang.Short" length="6" not-null="false" unique="false"
	 */
	public Short getPaymentMethodType() {
		return this.paymentMethodType;
	}
	
	/**
	 * Set the paymentMethodType
	 */	
	public void setPaymentMethodType(Short aValue) {
		this.paymentMethodType = aValue;
	}	

	/**
	 * @return String
	 * @hibernate.property column="protocol" type="java.lang.String" length="8" not-null="false" unique="false"
	 */
	public String getProtocol() {
		return this.protocol;
	}
	
	/**
	 * Set the protocol
	 */	
	public void setProtocol(String aValue) {
		this.protocol = aValue;
	}	

	/**
	 * @return Integer
	 * @hibernate.property column="sortOrder" type="java.lang.Integer" length="11" not-null="false" unique="false"
	 */
	public Integer getSortOrder() {
		return this.sortOrder;
	}
	
	/**
	 * Set the sortOrder
	 */	
	public void setSortOrder(Integer aValue) {
		this.sortOrder = aValue;
	}	

	/**
	 * @return Short
	 * @hibernate.property column="status" type="java.lang.Short" length="6" not-null="false" unique="false"
	 */
	public Short getStatus() {
		return this.status;
	}
	
	/**
	 * Set the status
	 */	
	public void setStatus(Short aValue) {
		this.status = aValue;
	}	

	/**
	 * @return Integer
	 * @hibernate.property column="version" type="java.lang.Integer" length="11" not-null="false" unique="false"
	 */
	public Integer getVersion() {
		return this.version;
	}
	
	/**
	 * Set the version
	 */	
	public void setVersion(Integer aValue) {
		this.version = aValue;
	}	

	/**
	 * @see java.lang.Object#equals(Object)
	 */
	public boolean equals(Object object) {
		if (!(object instanceof PaymentMethod)) {
			return false;
		}
		PaymentMethod rhs = (PaymentMethod) object;
		return new EqualsBuilder()
				.append(this.paymentMethodId, rhs.paymentMethodId)
						.append(this.paymentMethodName, rhs.paymentMethodName)
				.append(this.paymentMethodDetail, rhs.paymentMethodDetail)
				.append(this.paymentMethodType, rhs.paymentMethodType)
				.append(this.protocol, rhs.protocol)
				.append(this.helpLink, rhs.helpLink)
				.append(this.sortOrder, rhs.sortOrder)
				.append(this.status, rhs.status)
				.append(this.version, rhs.version)
				.isEquals();
	}

	/**
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return new HashCodeBuilder(-82280557, -700257973)
				.append(this.paymentMethodId) 
						.append(this.paymentMethodName) 
				.append(this.paymentMethodDetail) 
				.append(this.paymentMethodType) 
				.append(this.protocol)
				.append(this.helpLink) 
				.append(this.sortOrder) 
				.append(this.status) 
				.append(this.version) 
				.toHashCode();
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new ToStringBuilder(this)
				.append("paymentMethodId", this.paymentMethodId) 
						.append("paymentMethodName", this.paymentMethodName) 
				.append("paymentMethodDetail", this.paymentMethodDetail) 
				.append("paymentMethodType", this.paymentMethodType) 
				.append("protocol", this.protocol)
				.append("helpLink", this.helpLink) 
				.append("sortOrder", this.sortOrder) 
				.append("status", this.status) 
				.append("version", this.version) 
				.toString();
	}

	/**
	 * Return the name of the first key column
	 */
	public String getFirstKeyColumnName() {
		return "paymentMethodId";
	}

	public Short getIscod() {
		return iscod;
	}

	public void setIscod(Short iscod) {
		this.iscod = iscod;
	}

	public String getHelpLink() {
		return helpLink;
	}

	public void setHelpLink(String helpLink) {
		this.helpLink = helpLink;
	}
	
}